using UnityEngine;
using System.Collections;

public class TestCoroutine : MonoBehaviour {

	private bool isStartCall = false;  //Makesure Update() and LateUpdate() Log only once
	private bool isUpdateCall = false;
	private bool isLateUpdateCall = false;
	// Use this for initialization
	void Start () {
		/*if (!isStartCall)
		{
			Debug.Log("Start Begin");
			StartCoroutine(StartCoutine());
			Debug.Log("Start End");
		}*/
		print ("start");
		StartCoroutine(StartCoutine());

	}
	IEnumerator StartCoutine()
	{
		Debug.Log("Start1");
		while (true) {
			print ("while");
			yield return null;	//等待下一次执行
		}
		Debug.Log("Start2");
	}
	// Update is called once per frame
	void Update () {
		Debug.Log("Update Begin");
		//StartCoroutine(UpdateCoutine());
		//Debug.Log("Update End");
		//print(Time.timeScale);
	}
	IEnumerator UpdateCoutine()
	{
		Debug.Log("Update1");
		yield return null;
		StartCoroutine(StartCoutine());
		Debug.Log("Update2");
	}
}